package com.changanw.middleware.whitelist.config;

import com.changanw.middleware.whitelist.DoJoinPoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnClass(WhiteListProperties.class)
@EnableConfigurationProperties(WhiteListProperties.class)
public class WhiteListAutoConfigure {

    /*@Bean("whiteListConfig")
    @ConditionalOnMissingBean
    public String whiteListConfig(WhiteListProperties properties) {
        return properties.getUsers();
    }*/
    /*@Bean("whiteProperties")
    @ConditionalOnMissingBean
    public WhiteListProperties whiteListProperties(@Qualifier("whiteProperties") WhiteListProperties listProperties) {
        return listProperties;
    }*/

    /**
     * 此处需要注意的是在这个地方注入bean 可以不在测试启动类上加@ComponentScan注解
     * 如果在DoJoinPoint 类上加了@Component注解 就需要增加上边的注解 且包名要一致
     * @return
     */
    @Bean
    @ConditionalOnMissingBean
    public DoJoinPoint point(){
        return new DoJoinPoint();
    }

}